package com.wteam.clightmini.controller;


import com.wteam.clightmini.pojo.Test;
import com.wteam.clightmini.service.TestService;
import com.wteam.system.common.PageInfo;
import com.wteam.system.common.ResultMessage;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 * <p>
 *  前端控制器
 * </p>
 *
 * @author 许则丕
 * @since 2022-07-12
 */
@RestController
@RequestMapping("/test")
@Api(tags = "系统：测试")
public class TestController {
    @Autowired
    private TestService testService;

    @ApiOperation("新增")
    @PostMapping("/add")
    public ResultMessage add(Test test){
        return testService.add(test);
    }

    @ApiOperation("编辑")
    @PutMapping("/edit")
    public ResultMessage edit(Test test){
        return testService.edit(test);
    }

    @ApiOperation("删除")
    @DeleteMapping("/delete")
    public ResultMessage delete(Long id){
        return testService.delete(id);
    }

    @ApiOperation("分页")
    @GetMapping("/page")
    public ResultMessage page(PageInfo pageInfo){
        return testService.page(pageInfo);
    }
}
